<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Edit Hotel</title>
</head>
<body>
<%
   
    String id = request.getParameter("id");
    Class.forName("org.mariadb.jdbc.Driver");
   
    String url = "jdbc:mariadb://10.220.140.102:3366/studb11";
        String user ="stua";
        String password = "zHZUA65r";
    Connection connection = DriverManager.getConnection(url, user, password);
    Statement stmt = connection.createStatement();
    System.out.println("SELECT * FROM hotel WHERE id = "+id);
    ResultSet rs = stmt.executeQuery("SELECT * FROM hotel WHERE id = "+id);
        if (rs.next()) {
          
            String hotel = rs.getString("name");
            String city = rs.getString("city");
            String score = rs.getString("score");}
        rs.close();
        stmt.close();
        connection.close();
%>
<form action="modify.jsp" method="post">
name:<input type="text" name="hname" /><br>
city:<input type="text" name="city" /><br>
score:<input type="number" name="score" min="1" max="10"/><br>
<input type="submit" value="保存"/>
<input type="hidden" name="id" value="<%=id%>"/>
</form>

</body>
</html>
